<!doctype html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
    <meta name="generator" content="Hugo 0.80.0">
    <title>管理博客</title>

    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.css}" rel="stylesheet">

    <style>
        .bd-placeholder-img {
            font-size: 1.125rem;
            text-anchor: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        @media (min-width: 768px) {
            .bd-placeholder-img-lg {
                font-size: 3.5rem;
            }
        }

        .text-center td {
            vertical-align: middle;
        }

    </style>

    <link th:href="@{/css/dashboard.css}" rel="stylesheet">
</head>
<body>

<!--头部导航栏-->
<div th:replace="commons/common_admin::topNavigationBar(searchName=${blogName})"></div>

<div class="container-fluid">
    <div class="row">

        <!--侧边栏-->
        <div th:replace="commons/common_admin::sidebar(listBlog)"></div>

        <!--内容-->
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">
            <a class="btn btn-sm btn-success" th:href="@{/admin/addBlog}"
               style="margin: 10px; height: 36px; width: 88px; line-height: 24px; font-size: 16px;">添加博客</a>
            <div class="clearfix"></div>
            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead>
                    <tr class="text-center">
                        <!--<th>博客序号</th>-->
                        <th width="26%">博客标题</th>
                        <th width="16%">浏览量</th>
                        <th width="10%">状态</th>
                        <th width="16%">分类</th>
                        <th width="16%">创建时间</th>
                        <th width="16%">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="blog:${blogs.records}" class="text-center">
                        <!--<td th:text="${blog.blogId}"></td>-->
                        <td th:text="${blog.blogTitle}"></td>
                        <td th:text="${blog.blogViews}"></td>
                        <td th:text="${#strings.equals(blog.blogStatus, '0') ? '草稿' : '发布'}"></td>
                        <td th:text="${blog.blogCategoryName}"></td>
                        <td th:text="${#dates.format(blog.createTime, 'yyyy-MM-dd')}"></td>
                        <td>
                            <a class="btn btn-sm btn-primary" id="edit"
                               th:href="@{/admin/updateBlog/{blogId}(blogId=${blog.blogId})}">编辑</a>
                            <a class="btn btn-sm btn-danger" id="delete"
                               th:href="@{/admin/removeBlog/{blogId}(blogId=${blog.blogId})}">删除</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <div>
                当前第 [[${blogs.current}]] 页，共 [[${blogs.pages}]] 页，共 [[${blogs.total}]] 条
                <nav aria-label="Page navigation example" th:if="${blogs.pages>0}">
                    <ul class="pagination justify-content-center">
                        <li th:class="${blogs.current == 1 ? 'page-item disabled' : 'page-item'}">
                            <a class="page-link" th:if="${blogs.current == 1}" th:href="@{/admin/listBlog(current=1,searchName=${blogName})}">Previous</a>
                            <a class="page-link" th:if="${blogs.current != 1}"
                               th:href="@{/admin/listBlog(current=${blogs.current - 1},searchName=${blogName})}">Previous</a>
                        </li>
                        <!--<li class="page-item active" aria-current="page"><span class="page-link">2</span></li>-->

                        <li th:class="${blogs.current == pages ? 'page-item active' : 'page-item'}"
                            th:each="pages:${#numbers.sequence(1, blogs.pages)}">
                            <a class="page-link" th:href="@{/admin/listBlog(current=${pages},searchName=${blogName})}" th:text="${pages}"></a>
                        </li>
                        <li th:class="${blogs.current == blogs.pages ? 'page-item disabled' : 'page-item'}">
                            <a class="page-link" th:if="${blogs.current == blogs.pages}"
                               th:href="@{/admin/listBlog(current=${blogs.current},searchName=${blogName})}">Next</a>
                            <a class="page-link" th:if="${blogs.current != blogs.pages}"
                               th:href="@{/admin/listBlog(current=${blogs.current + 1},searchName=${blogName})}">Next</a>
                        </li>
                    </ul>
                </nav>
            </div>

        </main>
    </div>
</div>

</body>
<div th:replace="commons/common_admin::adminJs"></div>
<!--可选参数-->
<div th:replace="commons/common_admin::searchBlogJs"></div>
</html>
